//
//  ChooseProductCell.m
//  DaiShengInvest
//
//  Created by 张睿 on 2017/7/4.
//  Copyright © 2017年 davinci. All rights reserved.
//

#import "ChooseProductCell.h"


//  增长颜色
#define RED_COLOR   ColorWithRGB(0xf25167)
#define GREEN_COLOR  ColorWithRGB(0x00c55b)

@interface ChooseProductCell ()



@end

@implementation ChooseProductCell



- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self setupUI];
    }
    
    return self;
}


- (void)setupUI{
    
    self.backgroundColor = [UIColor clearColor];
    
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    
    self.countryImage = [UIImageView new];
    
    self.countryImage.backgroundColor = [UIColor whiteColor];
    self.countryImage.contentMode = UIViewContentModeScaleAspectFill;
    
    [self addSubview:self.countryImage];
    
    [self.countryImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(48 * SCREENH6);
        make.width.mas_equalTo(65 * SCREENH6);
        make.leading.mas_equalTo(self).offset(15 * SCREENH6);
        make.top.mas_equalTo(self).offset(15 * SCREENH6);
    }];
    
    self.englishLabel = [UILabel new];
    
    self.englishLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:13 * SCREENH6];
    self.englishLabel.textColor = ColorWithRGB(0xffffff);
    self.englishLabel.textAlignment = NSTextAlignmentLeft;
    //===========
    self.englishLabel.text = @"USDCNH";
    
    [self addSubview:self.englishLabel];
    
    [self.englishLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(self.countryImage);
        make.top.mas_equalTo(self.countryImage.mas_bottom).offset(5 * SCREENH6);
    }];
    
    
    self.chineseLabel = [UILabel new];
    
    self.chineseLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:16 * SCREENH6];
    self.chineseLabel.textColor = ColorWithRGB(0xffffff);
    self.chineseLabel.textAlignment = NSTextAlignmentLeft;
    //===========
    self.chineseLabel.text = @"美元人民币";
    
    [self addSubview:self.chineseLabel];
    
    [self.chineseLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(self.countryImage.mas_trailing).offset(10 * SCREENH6);
        make.top.mas_equalTo(self).offset(20 * SCREENH6);
    }];
    
    
    self.explationLabel = [UILabel new];
    
    self.explationLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:15 * SCREENH6];
    self.explationLabel.textColor = ColorWithRGB(0xaaaaaa);
    self.explationLabel.textAlignment = NSTextAlignmentLeft;
    //===========
    self.explationLabel.text = @"10元美元起投";
    
    [self addSubview:self.explationLabel];
    
    [self.explationLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(self.chineseLabel);
        make.top.mas_equalTo(self.chineseLabel.mas_bottom).offset(5 * SCREENH6);
    }];
    
    
    self.operationLabel = [UILabel new];
    
    self.operationLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:16 * SCREENH6];
    self.operationLabel.textColor = GREEN_COLOR;
    self.operationLabel.textAlignment = NSTextAlignmentLeft;
    //===========
    self.operationLabel.text = @"持仓中";
    
    [self addSubview:self.operationLabel];
    
    [self.operationLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(self.chineseLabel.mas_trailing).offset(40 * SCREENH6);
        make.centerY.mas_equalTo(self);
    }];
    
    
    self.percentLabel = [UILabel new];
    
    self.percentLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:15 * SCREENH6];
    self.percentLabel.textColor = GREEN_COLOR;
    self.percentLabel.textAlignment = NSTextAlignmentLeft;
    //===========
    self.percentLabel.text = @"2.04%";
    
    [self addSubview:self.percentLabel];
    
    [self.percentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(self.operationLabel.mas_trailing).offset(45 * SCREENH6);
        make.top.mas_equalTo(self).offset(15 * SCREENH6);
    }];
    
    
    self.moneyLabel = [UILabel new];
    
    self.moneyLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:15 * SCREENH6];
    self.moneyLabel.textColor = ColorWithRGB(0x979797);
    self.moneyLabel.textAlignment = NSTextAlignmentLeft;
    //===========
    self.moneyLabel.text = @"1281.16%";
    
    [self addSubview:self.moneyLabel];
    
    [self.moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.percentLabel);
        make.top.mas_equalTo(self.explationLabel);
    }];
    
    self.lineView = [UIView new];
    
    self.lineView.backgroundColor = [UIColor whiteColor];
    self.lineView.alpha = 0.1;
    
    [self addSubview:self.lineView];
    
    
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.trailing.bottom.mas_equalTo(self);
        make.height.mas_equalTo(1 * SCREENH6);
    }];
}




- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
